<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>车辆调拨管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			//$("#name").focus();
			$("#inputForm").validate({
				messages: {
					destcompany: {noEqualTo: "借出公司不能与借入公司相同！"}
				},
				submitHandler: function(form){
					loading('正在提交，请稍等...');
					form.submit();
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
		});
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/exchg/tBusExchg/">车辆借调列表</a></li>
		<li class="active"><a href="${ctx}/exchg/tBusExchg/form?id=${tBusExchg.id}">车辆借调<shiro:hasPermission name="exchg:tBusExchg:edit">${not empty tBusExchg.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="exchg:tBusExchg:edit">查看</shiro:lacksPermission></a></li>
	</ul><br/>
	<form:form id="inputForm" modelAttribute="tBusExchg" action="${ctx}/exchg/tBusExchg/save" method="post" class="form-horizontal">
		<form:hidden path= "compbus.busid"/>
		<form:hidden path="sourcecompany.id"/>
		<form:hidden path="id"/>
		<sys:message content="${message}"/>		
		<div class="control-group">
			<label class="control-label">借出车牌号：</label>
			<div class="controls">
			<form:input path="compbus.licenseno"  class="span4" readonly="true" />
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">借出车座位数：</label>
			<div class="controls">
			<form:input path="compbus.seats" class="span4" readonly="true" />
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">借出公司：</label>
			<div class="controls">
				<form:input path="sourcecompany.name" htmlEscape="false" class="span4 required" readonly="true"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">借入公司：</label>
			<div class="controls">
				<%-- <form:input path="destcompany" htmlEscape="false" class="input-xlarge required"/> --%>
				<select name="destcompany" class="span4 required" noEqualTo="#companyid" onchange="checkOwnerid(this.options[this.options.selectedIndex].text,this.options[this.options.selectedIndex].value)">
					<option value="">--请选择--</option>
					<c:forEach items="${officelist}" var="office">
						<option value="${office.id}"
							<c:if test="${office.id eq tCompBus.office.id}">selected="selected"</c:if>>
							${office.name}</option>
					</c:forEach>
				</select> <span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">开始时间：</label>
			<div class="controls">
				<input name="startdate" type="text" readonly="readonly" maxlength="20" class="span4 Wdate required"
					value="${tomorrow}"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true,minDate:'${tomorrow}'});"/>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">结束时间：</label>
			<div class="controls">
				<input name="enddate" type="text" readonly="readonly" maxlength="20" class="span4 Wdate required"
					value="<fmt:formatDate value="${tBusExchg.enddate}" pattern="yyyy-MM-dd"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:true,minDate:'${tomorrow}'});"/>
			</div>
		</div>
		<%-- <div class="control-group">
			<label class="control-label">调拨类型：</label>
			<div class="controls">
				<form:input path="exchgtype" htmlEscape="false" maxlength="1" class="input-xlarge "/>
			</div>
		</div> --%>
		<div class="form-actions">
			<shiro:hasPermission name="exchg:tBusExchg:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
			<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
		</div>
	</form:form>
</body>
</html>